package com.zut.controller.shop;

import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.zut.pojo.Shop;
import com.zut.pojo.PageInfo;
import com.zut.service.ShopService;
import com.zut.service.impl.ShopServiceImpl;
import com.zut.vo.ShopVo;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author 张晨
 * @date 2024/9/6 15:58
 * @desc
 */

@WebServlet("/shop/select")
public class ShopSelectController extends HttpServlet {
    private ShopService ShopService = new ShopServiceImpl();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String businessId = req.getParameter("businessId");

        List<ShopVo> shop = ShopService.selectById(businessId);

        String jsonString = JSON.toJSONString(shop);

        resp.getWriter().write(jsonString);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }
}
